#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2018/8/16 10:32
# @Author  : youfeng
import copy


class ProxyEntity(object):
    def __init__(self, tag, proxy_list):
        if not isinstance(proxy_list, list):
            self.__proxy_list = []
            self.__length = 0
        else:
            self.__proxy_list = copy.deepcopy(proxy_list)
            self.__length = len(self.__proxy_list)

        # 代理标签
        self.__tag = tag

    #  获得代理数目信息
    def get_length(self):
        return self.__length

    # 获得代理
    def get_proxy(self, index):
        if self.__length <= 0:
            return None, index

        if index >= self.__length:
            index = 0

        return self.__proxy_list[index], index

    # 获得标签
    def get_tag(self):
        return self.__tag
